package workqueue;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import util.ConnectionUtil;

import java.io.IOException;

/**
 * @program: rabbitmq-demo1
 * @description: 工作模式-生产者
 * @author: luolidong
 * @create: 2021-06-27 17:27
 * @version: 1.0
 */
public class Provider {
    public static void main(String[] args) throws IOException {
        //获取连接对象
        Connection connection = ConnectionUtil.createConnection();
        Channel channel = connection.createChannel();

        channel.queueDeclare("giao", true, false, false, null);
        for (int i = 0; i <20 ; i++) {
            channel.basicPublish("", "giao", null, ("giao giao "+i).getBytes());
        }
        ConnectionUtil.closeConnectionChannel(channel, connection);
    }

}
